import request from '@/utils/request.js'

// 注册-获取验证码
export const getcode = (tel)=> {
  return request({
    url:'/get/code',
    method: 'POST',
    data: {
      tel
    }
  })
}

// 账号注册
export const longinRegister = (userName,passWord,validCode) => {
  return request({
    url:'/user/authentication',
    method: 'POST',
    data:{
      userName,
      passWord,
      validCode
    }
  })
}

// 账号登录
export const userLongin = (userName,passWord) => {
  return request({
    method: 'POST',
    url:'/login',
    data:{
      userName,
      passWord
    }
  })
}

// 接口获取菜单权限数据
export const getMenuList = () => {
  return request.get("/user/getmenu")
}

// 权限修改
export const UpdatePermissions = (name,permissions,id) => {
  return request({
    method: 'POST',
    url:'/user/setmenu',
    data:{
      name,
      permissions,
      id
    }
  })
}

// 菜单权限列表
export const getPermissions = (pageNum,pageSize) => {
  return request({
    method: 'GET',
    url:'/menu/list',
    params: {
      pageNum,
      pageSize
    }
  })
}


// 获取 账号管理列表
export const getadmin = (pageNum,pageSize) => {
  return request({
    method: 'GET',
    url:'/auth/admin',
    params:{
      pageNum,
      pageSize
    }
  })
}

// 获取 菜单权限下拉
export const getselectlist = () => {
  return request({
    method: 'GET',
    url:'/menu/selectlist',
  })
}


export const updateuser = (name,permissions_id) => {
  return request({
    method: 'POST',
    url:'/update/user',
    data:{
      name,
      permissions_id
    }
  })
}


// 用户权限菜单
export const getmenupermissions = () => {
  return request({
    method: 'GET',
    url:'/menu/permissions',
  })
}



// 陪护师头像  list
export const getavatar = () => {
  return request({
    method: 'GET',
    url:'/photo/list',
  })
}

// 陪护师创建
export const getuser = (id,mobile,active,age,avatar,name,sex) => {
  return request({
    method: 'POST',
    url:'/companion',
    data:{
      id,
      mobile,
      active,
      age,
      avatar,
      name,
      sex
    }
  })
}

// 陪护师创建
export const getcompanionlist = (pageNum, pageSize) => {
  return request({
    method: 'GET',
    url: '/companion/list',
    params: {
      pageNum: Number(pageNum),
      pageSize: Number(pageSize)
    }
  })
}


// 删除陪护师
export const delcompanion = (data) => {
  return request.post("/delete/companion",data)
}
